#include <my_header.h>
// 没有取消点无法取消示例 
/* Usage:  ./11_pthread_cancel*/

void * func(void *arg){
    while(1){
    }
    return NULL;
}
int main()
{
    pthread_t  pid;
    int res = pthread_create(&pid, NULL, func, NULL);
    THREAD_ERROR_CHECK(res, "pthread_create");

    int res_cancel = pthread_cancel(pid);
    THREAD_ERROR_CHECK(res_cancel, "pthread_cancel");

    printf("main use cancel \n");    
    int res_join = pthread_join(pid, NULL);
    THREAD_ERROR_CHECK(res_join, "pthread_join");

    return 0;
}

